package com.xuelang;

import com.alibaba.fastjson2.JSON;
import com.xuelang.pipeline.client.application.dto.ApplicationDTO;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.pipeline.dto.PipelineDTO;
import com.xuelang.pipeline.entry.application.ApplicationController;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.test.context.junit.jupiter.SpringExtension;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertNotNull;


@Slf4j
@EnableCaching
@ExtendWith(SpringExtension.class)
@SpringBootTest(classes = SpringbootApp.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
public class ApplicationControllerTest {


    @Autowired
    private ApplicationController applicationController;


    @BeforeEach
    public void setUp() {
    }

    @Test
    public void testPagePipelineList() {
        PageRecord<PipelineDTO> pageRecord = new PageRecord<>();

        ApiResult<List<ApplicationDTO>> result = applicationController.listAppByKeyword("");

        log.info(JSON.toJSONString(result));

        assertNotNull(result.getData());
    }


}
